package com.delivery.www.servlet;

import com.delivery.www.po.User;

import java.util.Scanner;

import static com.delivery.www.servlet.Menu.menu;
import static com.delivery.www.servlet.OwnOrder.ownOrderPage;
import static com.delivery.www.servlet.UserStorePage.storePage;

public class UserPage {
    public static void userPage(User user) {
        System.out.println("============请选择你所需要的服务============");
        System.out.println("1.查看自己的信息");
        System.out.println("2.查看所有店铺");
        System.out.println("3.查看自己的订单");
        System.out.println("4.退出");
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        while (i != 1 && i != 2 && i != 3 && i != 4) {
            System.out.println("输入错误！请重新输入");
            i = scanner.nextInt();
        }
        if (i == 1) {
            System.out.println("用户名：" + user.getUserName());
            System.out.println("余额：" + user.getBalance());
            System.out.println("邮箱：" + user.getUserEmail());
            System.out.println("返回请按0");
            int i1 = scanner.nextInt();
            while (i1 != 0) {
                System.out.println("输入错误！请重新输入");
                i1 = scanner.nextInt();
            }
            userPage(user);
        }
        if (i == 2) {
            storePage(user);
        }
        if (i == 3) {
            ownOrderPage(user);
        }
        if (i == 4) {
            menu();
        }
    }
}
